<template>
    <a-form ref="formRef" :model="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 18 }">
        <a-form-item label="版本号" :rules="rules.version" name="version">
            <a-input v-model:value="form.version" placeholder="请输入版本" />
        </a-form-item>
        <a-form-item label="必要性" :rules="rules.isRequired" name="isRequired">
            <a-radio-group v-model:value="form.isRequired">
                <a-radio :value="false">非必须</a-radio>
                <a-radio :value="true">必须</a-radio>
            </a-radio-group>
        </a-form-item>
        <a-form-item label="下载地址" :rules="rules.url" name="url">
            <a-input v-model:value="form.url" placeholder="请输入下载地址" />
        </a-form-item>
    </a-form>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { useForm } from '@iframe/tools/mixins/FormMixins'

const { validate, getForm, setForm } = useForm()
const formRef = ref()
const form = reactive({})
const rules = reactive({
    version: { required: true, message: '请输入版本号' },
    isRequired: { required: true, message: '请选择必要性' },
    url: { required: true, message: '请输入下载地址' }
})

defineExpose({ validate: validate(formRef), getForm: getForm(form), setForm: setForm(form) })
</script>
